<?php
	require("includes/basic.php");
	if(!isset($_SESSION['uid']) && $userType!='O')
	{
		header("location:authorise.php");
	}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
	<HEAD>
		
		<TITLE> :: <?php echo $appName?> :: </TITLE>
		<link rel='stylesheet' type='text/css' href='style/inner.css'>
		<script type='text/javascript' src='js/inner.js'></script>

		<!-- validation start -->

		<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
		<link rel="stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
		<script src="js/jquery.validationEngine-en.js" type="text/javascript"></script>
		<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(document).ready(function(){
		    $("table#fileupload").hide();
		    $("p#upload").click(function(){
		    $("table#fileupload").show();
		    $("p#upload").html("");
		  });
		});
		</script>				
		<script>	
		$(document).ready(function() {

			
			$("#addtemp").validationEngine()
		
		});
		
		
		function validate2fields(){
			if($("#firstname").val() =="" ||  $("#lastname").val() == ""){
				return false;
			}else{
				return true;
			}
		}
		</script>
		
		<!-- validation end -->

	</HEAD>

	<body unselectable="on" class="dialog"> 
		<?php $pageName="Administration View"; ?>
		<?php require("includes/header.php"); ?>

		<!-- devi : body content begins here -->
		<table class="dialog" cellpadding="0" cellspacing="0"><tr><td> 
		<table class="dialogbox" cellpadding="0" cellspacing="0"> 
		<tr><td> 
		<div class="dialoghead" unselectable="on">



		Edit Template Wizard
		</div><div class="dialogcontent" style="height: 450px;" unselectable="on">

		<form method="post" onSubmit="return checkSubmit()" action="edit-template-process.php" name='' id="addtemp" class="nomargin" enctype="multipart/form-data">

		<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
		<tr><td style="vertical-align: top;">

		<div class="dialogspacer" unselectable="on">&nbsp;</div>
			<?php $buttonTitle = "Edit Template"; ?>
			<?php $buttonSize = "200px"; ?>
			<?php require("greenHeaderButton.php"); ?>
		<div class="dialogspacer" unselectable="on">&nbsp;</div>

		</td></tr>
		<tr><td style="vertical-align: middle;">
			<div class="dialogspacer" unselectable="on">&nbsp;</div>
			<div class="dialogspacer" unselectable="on">&nbsp;</div>
		</td></tr>
		<tr><td style="vertical-align: bottom;">


		<div class="dialogblockborder dialogblockborderheadline" unselectable="on"> 
		<div class="dialogblock" unselectable="on"> 
		<span class="dialogblockhead" unselectable="on">Template Details</span>
		
		
		<?php	
			if(isset($_SESSION['uid'])) {
			$tempid=$_REQUEST['temp_id'];	
			
			$tempdetails=mysql_query("select * from templates where content_id=$tempid");
			$row=mysql_fetch_array($tempdetails);
			
			extract($row);
			$title=$row['title'];
			$content=$row['content'];
			
					
		?>


		<table border="0" cellpadding="2" cellspacing="0">
			<tr>
				
				<td><input type="hidden" name="temp" id="temp" size="8" value='<?php echo$tempid;?>'></td>
				
			</tr>

			<tr>
				<td>Template Name : </td>
				<td><?php echo $title;?></td>
				<td><img id="img1" name="img1" src="images/help.png" border="0" onmouseout="hideHelp(1);" onmouseover="showHelp(1);"></td>
			</tr>
			<tr>
				<td>Template Content : </td>
				<td><TEXTAREA NAME="tempcont" id="tempcont" class="validate[required] text-input" ROWS="6" COLS="60"><?php echo $content;?></TEXTAREA></td>
				<td><img id="img2" name="img2" src="images/help.png" border="0" onmouseout="hideHelp(2);" onmouseover="showHelp(2);"></td>
			</tr>
           
			<tr>
				<td>Upload Images : </td>
				<td><INPUT TYPE="file" NAME="uploadedfile"></td>
				<td><img id="img3" name="img3" src="images/help.png" border="0" onmouseout="hideHelp(3);" onmouseover="showHelp(3);"></td>
			</tr>
            <tr><td><p id="upload" style="cursor:pointer;">Upload More Files</p></td><td>
					<table id="fileupload">
					<tr><td><input type="file" maxlength="255" name="file" id="file1"></td></tr>
					<tr><td><input type="file" maxlength="255" name="file2" id="file2"></td></tr>
					<tr><td><input type="file" maxlength="255" name="file3" id="file3"></td></tr>
					<tr><td><input type="file" maxlength="255" name="file4" id="file4"></td></tr>
					<tr><td><input type="file" maxlength="255" name="file5" id="file5"></td></tr>
					</table>
					 </td>
					 <td>&nbsp;</td>
			</tr>
            
		</table>
		</div></div>

		</td></tr>
		</table>
		</div>
		 

		<div class="dialogbuttons" unselectable="on">

		<input name="back" type="button" value="&#060;&#060; Back" class="dialogbutton" onclick="javascript:history.go(-1)">
		<input name="submit" type="submit" value="Save &#062;&#062;" class="dialogbutton">
		<input name="cancel" type="button" value="Cancel" class="dialogbutton" onclick="window.location.href='index.php';" style="margin-left: 50px;">
		</form>
		</div>


		<div class="help" name="help1" id="help1" onmouseout="hideHelp(1);" onmouseover="showHelp(1);">
			The Title of Template
		</div>


		<div class="help" name="help2" id="help2" onmouseout="hideHelp(2);" onmouseover="showHelp(2);">
			The HTML Content of the Template
		</div>

		<div class="help" name="help3" id="help3" onmouseout="hideHelp(3);" onmouseover="showHelp(3);">
			Upload Images (Upload only PNG,JPEG,TIFF,GIF)
		</div>


		</td></tr></table> 
		</td></tr></table> 
		<p>&nbsp;</p> 

		<!-- devi : body content ends here -->
		<?php }?>
		<?php require("includes/footer.php"); ?>
	</BODY>
</HTML>
